<#include "head.html"/>
<SCRIPT type="text/javascript">
	$(document).ready(function(){
		var ztree = $.fn.zTree.init($(document.getElementById("zTree_adminLIst")), setting, zNodes1);
		ztree.selectNode(ztree.getNodeByParam("id", "onlineuser", null));
	});
	
	function submitSearchForm(action){
		$("#beginNum").val($("#beginNumShow").val());
		$("#endNum").val($("#endNumShow").val());
		$("#action").val(action);
		$("#searchForm").submit();
	}
	
	//批量强制退出
	function submitRemoveForm(){
		if($("input[name='userids']:checked").length>0){
			art.confirm('您确定要强制退出这些用户吗？' 
			, function(){
				$("#userForm").submit();
			
			} 
			, function(){})
			
		}else{
			alertMsg("请选择要退出的用户！");
		}
		
		
	}
	//踢出
	function removeUserSession(currentPage,sessionId){
		var start = document.getElementById("startTime").value;
		var end = document.getElementById("endTime").value;
		var startDate = new Date(start);
		var endDate = new Date(end);
		if(endDate<startDate){
			document.getElementById("prompt").style.display="block";
			return;
		}
		if(sessionId!=null || sessionId!="" || sessionId!=undefined){
			document.getElementById("sessionId").value=sessionId;
		}
		$("#p").val(currentPage);
		$("#searchForm").submit();
	}
	
	function checkRadio(){
		var checkthis = $("input[name='thischecked']:checked").val();
		if(checkthis=="1"){
			document.getElementById("startTime").disabled=true;
			document.getElementById("endTime").disabled=true;
			document.getElementById("startTime").value="";
			document.getElementById("endTime").value="";
			document.getElementById("rangeTime").disabled=false;
			return;
		}
		if(checkthis=="2"){
			document.getElementById("rangeTime").disabled=true;
			document.getElementById("rangeTime").value="";
			document.getElementById("startTime").disabled=false;
			document.getElementById("endTime").disabled=false;
			return;
		}
	}
	
</SCRIPT>
<div class="rs_layout_top breadCrumbWrap">
	<div class="breadCrumbStart">您当前的位置是在：</div>
	<ul class="breadCrumb">
		<li class="bc_ithems"><a href="/${orgi}/manage/task/taskpassing.html">系统管理</a></li>
		<li class="bc_ithems"><a href="/${orgi}/manage/task/taskpassing.html">状态</a></li>
	</ul>
	
</div>
<div class="rs_layout_left" resizable="true" style="width:230px;">
	<div class="lftTreeWrap">
		<div class="task_title2">状态</div>
		<div class="ztree" id="zTree_adminLIst"></div>
		<div class="rs_layout_top" style="font-size: 12px" id="filterDiv">
		<form id="searchForm" action="/${orgi}/manage/task/onlineuser.html" method="post">	
		
			<input type="hidden" id="beginNum" name="beginNum" value="">
			<input type="hidden" id="endNum" name="endNum" value="">
			<input type="hidden" id="action" name="action" value="current">
			<input type="hidden" id="sessionId" name="sessionId" value="">
			<div class="task_title2">过滤器</div>

			
			<div style="padding-bottom: 20px;padding-left: 20px;border-bottom: solid 2px #ddd;">
				
					<div>
					<input type="radio" value="1" id="thischecked" name="thischecked" onclick="checkRadio();" <#if !thischecked?? || thischecked=="1">checked="checked"</#if>/>
					<label>时间范围选择：</label><br/>
						<select name="rangeTime"  id="rangeTime" <#if thischecked?? && thischecked=="2">disabled="disabled"</#if>>
							<option value="0" <#if rangeTime?? && rangeTime=="0">selected="selected"</#if>>过去5分钟</option>
							<option value="1" <#if !rangeTime?? || rangeTime=="1">selected="selected"</#if>>过去30分钟</option>
							<option value="2" <#if rangeTime?? && rangeTime=="2">selected="selected"</#if>>过去1小时</option>
							<option value="3" <#if rangeTime?? && rangeTime=="3">selected="selected"</#if>>过去4小时</option>
							<option value="4" <#if rangeTime?? && rangeTime=="4">selected="selected"</#if>>过去12小时</option>
							<option value="5" <#if rangeTime?? && rangeTime=="5">selected="selected"</#if>>过去1天</option>
							<option value="6" <#if rangeTime?? && rangeTime=="6">selected="selected"</#if>>更早之前</option>
						</select>
					</div>
					
					<div style="margin-top: 10px;">
					<input type="radio" value="2" id="thischecked" name="thischecked" onclick="checkRadio();" <#if thischecked?? && thischecked=="2">checked="checked"</#if>/>
					开始登陆时间：<input class="Wdate" type="text" onfocus="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endTime\')}'})" id="startTime" name="startTime" style="margin-top: 5px;" value="${startTime!''}" <#if !thischecked?? || thischecked=="1">disabled="disabled"</#if>/>
					<div style="margin-top: 10px;"></div>
					结束登陆时间：<input class="Wdate" type="text" onfocus="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startTime\')}'})" id="endTime" name="endTime" style="margin-top: 5px;" value="${endTime!''}"  <#if !thischecked?? || thischecked=="1">disabled="disabled"</#if>/>
					</div>
					
					
					<div style="margin-top: 10px;display:none;" id="prompt">
						<label style="color:red;">请正确设置开始,结束登陆时间</label>
					</div>
			
					
					<div style="margin-top: 10px;">
					<label>登陆用户：</label>
					<input type="text" name="userName" style="margin-top: 5px;" value="${userName!''}"/>
					</div>
					
				
					<div style="margin-top: 10px;">
						<label>状态：</label>
						<select name="status">
							<option value="0" <#if !status?? || status=="0">selected="selected"</#if>>任意</option>
							<option value="1" <#if status?? && status=="1">selected="selected"</#if>>活跃</option>
							<option value="2" <#if status?? && status=="2">selected="selected"</#if>>不活跃</option>
						</select>
					</div>

			</div>
			<div style="text-align: center;margin-top: 10px;background: #ddd;padding: 5px 0px;">
				<input class="subButtonStyle" style="margin:0px auto;" type="button" value="应用" onclick="submitSearchForm(1);">
			</div>
			</form>
		</div>
	</div>
</div>
<!--<div class="rs_layout_right" style="width:300px;"></div>-->
<div class="rs_layout_center">
	<div class="rs_layout">
		<div class="rs_layout_center">
		<form id="userForm" action="/${orgi}/manage/task/removeonlineuser.html" method="post">	
			
			<div class="tableScrollWrap">
					
				<table class="table_style_1">
					<thead>
						<tr>
							<th></th>
							<th nowrap="nowrap"><i class="minSize">当前用户</i><i class="tbArrow"></i></th>
							<th nowrap="nowrap"><i class="minSize">登陆时间</i><i class="tbArrow"></i></th>
							<th nowrap="nowrap"><i class="minSize">部门/组织机构</i><i class="tbArrow"></i></th>
							<th nowrap="nowrap"><i class="minSize">邮件地址</i><i class="tbArrow"></i></th>
							<th nowrap="nowrap"><i class="minSize">操作</i><i class="tbArrow"></i></th>
						</tr>
					</thead>
					<tbody>
						
						<#if onlineUserList??>
						<#list onlineUserList as onlieuser>
						<tr>
							<td class="tdIcons"><input name="userids" value="${onlieuser.birthday!''}" type="checkbox" style="border: 0px solid rgb(255, 255, 255);"></td>
							<td>${onlieuser.username!''}<#if onlieuser.nickname?? && onlieuser.nickname!=''>(${onlieuser.nickname!''})</#if></a></td>
							<td class="minSize">${onlieuser.loginTime?string("yyyy年MM月dd HH:mm:ss")}</td>
							<td class="minSize">${onlieuser.department!''}</td>
							<td class="minSize">${onlieuser.email!''}</td>
							<td class="minSize"><#if user?? && user.username!=onlieuser.username><a href="#" onclick="removeUserSession(${data.pages},'${onlieuser.birthday!''}');" data-target="ajax" >强制退出</a></#if></td>
						</tr> 
						</#list>
						</#if>
					</tbody>
				</table>
			</div>
			</form>
		</div>
		<div class="rs_layout_bottom toolBar_bottom">
			<div class="papers_1" style="float:left;line-height:18px;margin:0 10px 0 500px;">
				<span ><label style="font-size: 13px;">条目&nbsp;&nbsp;&nbsp;&nbsp;</label><input type="text" style="width: 30px;height: 10px;" id="beginNumShow" value="${beginNum!'1'}"/><label style="font-size: 13px;">-</label><input style="width: 30px;height: 10px;" type="text" id="endNumShow" value="${endNum!'20'}"/></span>
				<img class="pageElems" onclick="submitSearchForm('current');" title="查询" alt="查询" src="/assets/images/action_go.gif"/>
				<img class="pageElems" onclick="submitSearchForm('first');" title="首页" alt="首页" src="/assets/images/go-first-view.png"/>
				<img class="pageElems" onclick="submitSearchForm('last');" title="上一页" alt="上一页" src="/assets/images/go-previous-view.png"/>			
				<img class="pageElems" onclick="submitSearchForm('next');" title="下一页" alt="下一页" src="/assets/images/go-next-view.png"/>
				<img class="pageElems" onclick="submitSearchForm('final');" title="尾页" alt="尾页" src="/assets/images/go-last-view.png"/>
				
			</div>
			<ul class="toolbarBottom_IconWrap">
				<li title="强制退出选中" onclick="submitRemoveForm();" class="tb-icons-4"></li>
			</ul>
		</div>

	</div>
</div>
